/**
 * Created by user on 2018/3/20.
 */
import React, { Component } from 'react'
import { connect } from 'react-redux'
import GlobalTitle from '../globalTitle'
import LiveSwiper from './liveSwiper'
import VoiceStatus from './voiceStatus'
import LiveVideo from './liveVideo'
import MiddleTip from '../middleTip'
import LiveMaterial from './material'
class LiveScreen extends Component {
  renderPause() {
    const { pause } = this.props
    return pause ? <MiddleTip text="讲师暂停中"/> : null
  }
  render() {
    const { showDm } = this.props
    return (
      <div>
        <GlobalTitle />
        <div className={`live_screen ${showDm ? 'showDm' : 'hideDm'}`}>
          <VoiceStatus />
          { this.renderPause() }
          <LiveVideo/>
          <LiveSwiper />
          <LiveMaterial/>
        </div>
      </div>
    )
  }
}
const mapStateToProps = (state) => {
  return {
    teacherLeave: state.LiveState.teacher_leave,
    pause: state.LiveState.pause,
    showDm: state.DmState.show
  }
}
export default connect(mapStateToProps)(LiveScreen)
